import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;

/**
  * @author Avshalom Elmalech 	039281167
  * @author Moshe 	Beutel 		037580792
 */
public class Ex2 {	 
	
	public static void main(String[] args) {
		World world = new World();
		View view = new View();
		
		try{
			//read input files and create world
			world.readScene("ex2.scn");
			view.readView("ex2.viw");
			//update view with world data
			view.setArgs(world);
			//update view according to the view file
			view.updateView();
			
			Frame myFrame = new Frame("Ex2");
			//ad view to frame
			myFrame.add(view);

			WindowAdapter myWindowAdapter = new WindowAdapter(){
				public void windowClosing(WindowEvent e) {
					System.exit(0);
				}
			};
			view.setFocusable(true);
			myFrame.addWindowListener(myWindowAdapter);
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
			SwingUtilities.updateComponentTreeUI(myFrame);
			myFrame.pack();
			myFrame.setVisible(true);	

		}catch(Exception e ){
			e.printStackTrace();
		}
		
		
	}

}
